﻿using HalconDotNet;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Kimd.Vision
{
    [Serializable]
    public class LineNB : ShapeNB
    {
        public PointF StartPoint;
        public PointF EndPoint;

        public LineNB()
            : base()
        {

        }
        public override void Draw(HWindow window, Graphics g, Func<PointF, PointF> pixel2Window, Func<float, float> lenConvert, bool disableEdit)
        {
            window.SetColor(PaintColor);
            window.SetLineWidth(LineWidth);
            window.SetDraw("margin");
            window.DispLine(new HTuple(StartPoint.Y), new HTuple(StartPoint.X), new HTuple(EndPoint.Y), new HTuple(EndPoint.X));
        }
        public override HObject ToRegion()
        {
            HObject l = null;
            HOperatorSet.GenRegionLine(out l, new HTuple(StartPoint.Y), new HTuple(StartPoint.X), new HTuple(EndPoint.Y), new HTuple(EndPoint.X));
            return l;
        }
    }
}
